﻿<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Estad&iacute;sticas</title>

		<script type="text/javascript" src="js/jquery.min.js"></script>
                
<?php 
require_once '../funciones.php'; 
//include ("seguridad.php");
conexion();
$result=mysql_query(" select  ROUND(sum(v.superficie),2) cant, v.variedad from gis.vistaestado  as v group by v.variedad  ");
$i=1;
echo"<script type='text/javascript'>
                    
$(function () { 
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                text: 'Variedades de la Campaña'
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';
                }
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                type: 'pie',
                name: 'Estados',
                data: [";
                while($row=mysql_fetch_array($result)){
                    if($i==1) { 
                       echo" {
                        name: '".$row['variedad']."',
                        y: ".($row['cant']).",
                        sliced: true,
                        selected: true
                    },";}  else{echo" ['".$row['variedad']."', ".($row['cant'])."],";}
                    $i++;
                         
                
                   
                }   
              echo"  ]
            }]
        });
    });
    
});
		</script>";
$result=mysql_query("select  ROUND(sum(v.superficie),2) cant, v.modulo as nombre from gis.vistaestado  as v group by v.modulo order by nombre   ");
$i=1;

                
		echo"<script type='text/javascript'>
                    
$(function () { 
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container1',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                text: 'Cantidad de Lotes por Módulo '
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';
                }
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                type: 'pie',
                name: 'Estados',
                data: [";
                while($row=mysql_fetch_array($result)){
                    if($i==1) { 
                       echo" {
                        name: '".$row['nombre']."',
                        y: ".($row['cant']).",
                        sliced: true,
                        selected: true
                    },";}  else{echo" ['".$row['nombre']."', ".($row['cant'])."],";}
                    $i++;
                         
                
                   
                }   
              echo"  ]
            }]
        });
    });
    
});
		</script>";
              
$result=mysql_query("select  ROUND(sum(v.superficie),2) cant, v.estado as nombre from gis.vistaestado  as v group by v.estado order by cant   ");
$i=1;
 
                
		echo"<script type='text/javascript'>
                    
$(function () { 
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container2',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                text: 'Estados'
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';
                }
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                type: 'pie',
                name: 'Estados',
                data: [";
                while($row=mysql_fetch_array($result)){
                    if($i==1) { 
                       echo" {
                        name: '".$row['nombre']."',
                        y: ".($row['cant']).",
                        sliced: true,
                        selected: true
                    },";}  else{echo" ['".$row['nombre']."', ".($row['cant'])."],";}
                    $i++;
                         
                
                   
                }   
              echo"  ]
            }]
        });
    });
    
});
		</script>";
              
conexion();
$result=mysql_query("select  ROUND(sum(v.superficie),2) cant,v.contrat as nombre from gis.vistaestado  as v group by v.contrat order by nombre   ");
$i=1;
 
                
		echo"<script type='text/javascript'>
                    
$(function () { 
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container3',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                text: 'Contratistas'
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';
                }
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                type: 'pie',
                name: 'Estados',
                data: [";
                while($row=mysql_fetch_array($result)){
                    if($i==1) { 
                       echo" {
                        name: '".$row['nombre']."',
                        y: ".($row['cant']).",
                        sliced: true,
                        selected: true
                    },";}  else{echo" ['".$row['nombre']."', ".($row['cant'])."],";}
                    $i++;
                         
                
                   
                }   
              echo"  ]
            }]
        });
    });
    
});
</script>";
              
                 $result=mysql_query("select  ROUND(sum(v.superficie),2) cant,v.respons  as nombre from gis.vistaestado  as v group by v.respons order by nombre    ");
   $i=1;
 
                
		echo"<script type='text/javascript'>
                    
$(function () { 
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container4',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                text: 'Responsables'
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';
                }
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                type: 'pie',
                name: 'Estados',
                data: [";
                while($row=mysql_fetch_array($result)){
                    if($i==1) { 
                       echo" {
                        name: '".$row['nombre']."',
                        y: ".($row['cant']).",
                        sliced: true,
                        selected: true
                    },";}  else{echo" ['".$row['nombre']."', ".($row['cant'])."],";}
                    $i++;
                         
                
                   
                }   
              echo"  ]
            }]
        });
    });
    
});
		</script>";?>

	</head>
	<body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>
<div style="width: 1050px; margin: 0 auto;">
<div id="container" style="width: 500px; height: 400px; margin: 0 auto; float: left "></div>

<div id="container1" style="width: 500px; height: 400px; margin: 0 auto; float: right"></div>
</div>
<div style="width: 1050px; margin: 0 auto;">
<div id="container2" style="width: 500px; height: 400px; margin: 0 auto; float: left "></div>

<div id="container3" style="width: 500px; height: 400px; margin: 0 auto; float: right"></div>
</div>
<div style="width: 1050px; margin: 0 auto;">
<div id="container4" style="width: 500px; height: 400px; margin: 0 auto; float: left "></div>

<div id="container5" style="width: 500px; height: 400px; margin: 0 auto; float: right"></div>
</div>
	</body>
</html>
